//获取应用实例
const app = getApp()

Page({
  data: {

  },
  onLoad: function () {
    var that = this;

    wx.request({
      url: app.globalData.remoteServerPath + 'study/japanese/titleUnit/listDataGrid.do',
      method: 'POST',
      header: { 'content-type': 'application/x-www-form-urlencoded' },
      success: function (res) {

        var data = res.data.result; 
        var status = res.data.success;

        for (var i = 0; i < data.length; i++) {
          var str = data[i].id;

        }

        that.setData({
          list: data
        })

      },
      fail: function (res) {
        console.log('submit fail');
      }

    })
  },
  chooseUnit: function(event) {
   
    app.validationLogin({
      callback: function() {
        wx.navigateTo({
          url: '../vocabulary/vocabulary?unitId=' + event.target.id,
          success: function (res) {
            //播放点击音频
            app.playBackgroundAudio(app.data.audioPath["audio_click"]);
          }
        })
      }
    })


  }
})
